package com.yiboshi.rehrs.domain.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yiboshi.rehrs.domain.entity.ZhongUserImage;
import com.yiboshi.rehrs.domain.mapper.ZhongUserImageMapper;
import com.yiboshi.rehrs.domain.service.IZhongUserImageService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yiboshi.rehrs.util.CacheUtils;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author local
 * @since 2025-03-21
 */
@Service
public class ZhongUserImageServiceImpl extends AperBaseServiceImpl<ZhongUserImageMapper, ZhongUserImage> implements IZhongUserImageService {




    @Override
    public ZhongUserImage getOne(String account) {
        String key = "zhong_user_image_" + account;
        ZhongUserImage zhongUserImage = CacheUtils.getByCache10Hour(key, ZhongUserImage.class);
        if(zhongUserImage!=null){
            return zhongUserImage;
        }
        LambdaQueryWrapper<ZhongUserImage> queryWrapper = this.getQueryWrapper().eq(ZhongUserImage::getAccount, account);
        zhongUserImage= this.getOne(queryWrapper);
        if(zhongUserImage==null){
            return null;
        }
        CacheUtils.putByCache10Hour(key,zhongUserImage);
        return zhongUserImage;
    }
}
